package com.httam.taxiSmart;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MyCustomAdapter extends ArrayAdapter<String> {
	Context context;
	Integer[] thumbnails;
	ArrayList<String> items;
	
	public MyCustomAdapter(Context context, int resource, ArrayList<String> arrListTaxi,
			Integer[] thumbnails) {
		super(context, R.layout.activity_custom_list, arrListTaxi);
		this.context = context;
		this.thumbnails = thumbnails;
		this.items = arrListTaxi;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = ((Activity)context).getLayoutInflater();
		View row = inflater.inflate(R.layout.activity_custom_list, null);
		
		TextView labelName = (TextView)row.findViewById(R.id.lblTaxiName);
		ImageView icon = (ImageView)row.findViewById(R.id.icon);
		
		labelName.setText(items.get(position));
		icon.setImageResource(thumbnails[position]);
		return (row);
	}
	
	

}
